import { assertEquals } from "asserts";

import reversePairs from "./index.ts";

Deno.test("shu-zu-zhong-de-ni-xu-dui-lcof", () => {
    assertEquals(reversePairs([7, 5, 6, 4]), 5);
});
Deno.test("shu-zu-zhong-de-ni-xu-dui-lcof", () => {
    assertEquals(
        reversePairs([
            991,
            31,
            107,
            383,
            514,
            939,
            540,
            878,
            592,
            725,
            801,
            241,
            134,
            218,
            557,
            952,
            175,
            815,
            120,
            235,
            840,
            991,
            876,
            587,
            210,
            883,
            679,
            653,
            539,
            433,
            741,
            374,
            791,
            247,
            381,
            808,
            301,
            69,
            628,
            616,
            309,
            169,
            894,
            908,
            241,
            136,
            172,
            843,
            378,
            204,
            242,
            68,
            549,
            565,
            818,
            151,
            627,
            857,
            236,
            175,
            510,
            486,
            719,
            494,
            241,
            975,
            997,
            145,
            387,
            16,
            771,
            678,
            507,
            257,
            392,
            941,
            402,
            234,
            787,
            439,
            277,
            19,
            602,
            675,
            642,
            228,
            432,
            350,
            25,
            396,
            363,
            732,
            822,
            740,
            598,
            631,
            193,
            672,
            268,
            214,
            329,
            309,
            435,
            606,
            702,
            201,
            311,
            826,
            304,
            755,
            965,
            187,
            75,
            732,
            714,
            721,
            390,
            114,
            655,
            141,
            812,
            37,
            337,
            677,
            582,
            805,
            159,
            113,
            736,
            673,
            777,
            777,
            729,
            205,
            390,
            489,
            933,
            994,
            480,
            74,
            50,
            669,
            563,
            863,
            389,
            143,
            221,
            849,
            352,
            783,
            3,
            377,
            265,
            325,
            59,
            601,
            798,
            494,
            633,
            222,
            642,
            628,
            212,
            272,
            492,
            76,
            185,
            240,
            992,
            296,
            852,
            613,
            521,
            558,
            496,
            206,
            483,
            505,
            84,
            681,
            692,
            791,
            311,
            815,
            217,
            622,
            720,
            462,
            607,
            373,
            513,
            85,
            831,
            895,
            585,
            469,
            850,
            643,
            114,
            486,
            171,
            176,
            983,
            821,
            594,
            739,
            656,
            589,
            14,
            72,
            333,
            911,
            410,
            779,
            779,
            436,
            750,
            629,
            474,
            538,
            831,
            371,
            221,
            377,
            974,
            849,
            927,
            640,
            784,
            797,
            45,
            440,
            971,
            949,
            573,
            647,
            588,
            129,
            623,
            876,
            975,
            737,
            106,
            285,
            50,
            901,
            462,
            143,
            21,
            257,
            217,
            676,
            642,
            98,
            937,
            818,
            440,
            913,
            927,
            554,
            578,
            832,
            355,
            575,
            562,
            402,
            21,
            469,
            296,
            865,
            824,
            144,
            199,
            769,
            500,
            397,
            242,
            167,
            883,
            905,
            695,
            339,
            355,
            98,
            324,
            726,
            904,
            345,
            105,
            430,
            564,
            870,
            4,
            762,
            268,
            76,
            280,
            873,
            90,
            622,
            17,
            569,
            84,
            763,
            466,
            994,
            433,
            919,
            804,
            233,
            227,
            119,
            840,
            107,
            580,
            402,
            470,
            344,
            984,
            844,
            88,
            784,
            689,
            421,
            866,
            811,
            759,
            754,
            598,
            719,
            146,
            185,
            798,
            315,
            524,
            293,
            72,
            865,
            237,
            765,
            364,
            296,
            492,
            890,
            31,
            459,
            2,
            250,
            680,
            120,
            921,
            212,
            350,
            751,
            445,
            524,
            955,
            806,
            633,
            588,
            520,
            559,
            182,
            155,
            341,
            748,
            599,
            455,
            305,
            383,
            645,
            177,
            227,
            558,
            786,
            891,
            737,
            530,
            131,
            35,
            219,
            704,
            4,
            435,
            4,
            96,
            148,
            718,
            802,
            280,
            753,
            486,
            728,
            719,
            878,
            369,
            251,
            857,
            928,
            134,
            844,
            494,
            645,
            467,
            913,
            532,
            719,
            434,
            490,
            440,
            274,
            640,
            989,
            368,
            187,
            486,
            791,
            5,
            567,
            734,
            654,
            553,
            586,
            637,
            431,
            994,
            32,
            532,
            331,
            805,
            997,
            119,
            50,
            403,
            988,
            578,
            763,
            615,
            495,
            148,
            127,
            307,
            709,
            143,
            872,
            912,
            722,
            557,
            574,
            753,
            676,
            208,
            268,
            368,
            742,
            343,
            350,
            240,
            84,
            311,
            614,
            73,
            784,
            668,
            387,
            874,
            579,
            18,
            200,
            807,
            128,
            774,
            848,
            201,
            821,
            257,
            562,
            172,
            478,
            798,
            777,
            778,
            885,
            981,
            437,
            47,
            836,
            586,
            591,
            604,
            241,
            161,
            540,
            412,
            644,
            287,
            555,
            123,
            785,
            452,
            953,
            142,
            779,
            642,
            566,
            410,
            652,
            368,
            241,
            412,
            635,
            562,
            550,
            186,
            733,
            824,
            882,
            720,
            977,
            767,
            606,
            136,
            201,
            158,
            413,
            225,
            450,
            340,
            307,
            699,
            111,
            320,
            58,
            506,
            693,
            137,
            933,
            640,
            273,
            801,
            214,
            43,
            508,
            764,
            851,
            280,
            389,
            695,
            276,
            787,
            625,
            689,
            936,
            45,
            654,
            149,
            87,
            505,
            725,
            449,
            41,
            489,
            42,
            50,
            427,
            306,
            432,
            338,
            332,
            263,
            834,
            385,
            595,
            335,
            77,
            120,
            217,
            448,
            206,
            434,
            830,
            997,
            560,
            487,
            565,
            751,
            765,
            720,
            849,
            857,
            493,
            263,
            791,
            603,
            808,
            571,
            946,
            156,
            304,
            586,
            304,
            435,
            30,
            543,
            349,
            6,
            124,
            917,
            727,
            12,
            551,
            212,
            553,
            128,
            61,
            79,
            797,
            801,
            233,
            353,
            439,
            213,
            497,
            894,
            880,
            629,
            321,
            465,
            565,
            955,
            895,
            798,
            22,
            770,
            166,
            898,
            26,
            335,
            357,
            651,
            719,
            943,
            941,
            469,
            566,
            465,
            899,
            143,
            204,
            385,
            464,
            421,
            77,
            812,
            637,
            9,
            137,
            270,
            96,
            226,
            566,
            77,
            976,
            641,
            823,
            917,
            480,
            419,
            563,
            336,
            25,
            347,
            879,
            170,
            172,
            40,
            325,
            163,
            105,
            649,
            734,
            798,
            562,
            260,
            365,
            263,
            954,
            839,
            382,
            98,
            478,
            738,
            600,
            787,
            510,
            604,
            982,
            126,
            428,
            985,
            772,
            523,
            604,
            202,
            667,
            698,
            873,
            480,
            886,
            203,
            988,
            28,
            319,
            30,
            420,
            544,
            540,
            911,
            746,
            673,
            395,
            717,
            52,
            694,
            282,
            223,
            937,
            246,
            377,
            278,
            151,
            356,
            712,
            991,
            755,
            119,
            468,
            977,
            276,
            214,
            387,
            720,
            978,
            223,
            853,
            939,
            971,
            824,
            423,
            926,
            580,
            820,
            20,
            812,
            691,
            377,
            87,
            625,
            43,
            604,
            914,
            168,
            896,
            749,
            14,
            763,
            367,
            315,
            451,
            388,
            367,
            126,
            993,
            58,
            126,
            995,
            906,
            617,
            756,
            487,
            623,
            883,
            986,
            327,
            144,
            741,
            823,
            537,
            239,
            260,
            814,
            938,
            551,
            70,
            907,
            390,
            266,
            27,
            337,
            950,
            402,
            287,
            954,
            928,
            297,
            636,
            457,
            540,
            602,
            858,
            966,
            207,
            18,
            581,
            694,
            359,
            809,
            159,
            136,
            903,
            129,
            643,
            318,
            521,
            484,
            262,
            363,
            837,
            608,
            3,
            340,
            128,
            127,
            352,
            505,
            294,
            495,
            381,
            107,
            712,
            972,
            632,
            966,
            959,
            327,
            232,
            311,
            660,
            180,
            374,
            517,
            212,
            154,
            933,
            755,
            230,
            108,
            814,
            230,
            735,
            732,
            656,
            201,
            926,
            933,
            545,
            592,
            120,
            78,
            549,
            519,
            974,
            488,
            790,
            697,
            174,
            579,
            706,
            449,
            88,
            149,
            370,
            456,
            516,
            867,
            514,
            841,
            35,
            845,
            879,
            323,
            977,
            487,
            690,
            432,
            251,
            556,
            583,
            393,
            244,
            807,
            914,
            286,
            168,
            451,
            416,
            410,
            457,
            781,
            136,
            682,
            224,
            33,
            142,
            890,
            156,
            650,
            763,
            437,
            293,
            463,
            608,
            714,
            825,
            986,
            75,
            15,
            359,
            365,
            585,
            693,
            811,
            981,
            135,
            773,
            274,
            490,
            738,
            4,
            74,
            870,
            889,
            503,
            88,
            745,
            396,
            165,
            344,
            177,
            341,
            226,
            675,
            419,
            347,
            706,
            58,
            216,
            401,
            216,
            416,
            120,
            813,
            88,
            777,
            430,
            831,
            587,
            90,
            799,
            814,
            531,
            512,
            91,
            519,
            839,
            273,
            417,
            672,
            692,
            139,
            220,
            634,
            577,
            831,
            215,
            815,
            414,
            729,
            566,
            203,
            751,
            197,
            193,
            424,
            236,
            152,
            521,
            453,
            778,
            674,
        ]),
        251923,
    );
});
